package web.enumeditor;

import java.util.regex.Pattern;

/**
 * 民族
 * @author 陈瑞军
 */
public enum Nation {
	Han(1, "汉族族"), 
	MengGu(2, "蒙古族族"), 
	Hui(3, "回族族"), 
	Zang(4, "藏族族"), 
	WeiWuEr(5, "维吾尔族族"), 
	Miao(6, "苗族族"), 
	Yi(7, "彝族族"), 
	Zhuang(8, "壮族 族"),
	BuYi(9, "布依族族"), 
	ChaoXiaN(10, "朝鲜族族"), 
	Man(11, "满族族"), 
	Dong(12, "侗族族"), 
	Yao(13, "瑶族族"), 
	Bai(14, "白族族"), 
	TuJia(15, "土家族族"), 
	HaNi(16, "哈尼族族"),
	HaSaKe(17, "哈萨克族族"),
	Dai(18, "傣族族"), 
	Li(19, "黎族"), 
	ShuLi(20, "僳僳族"), 
	Wa(21, "佤族"), 
	She(22, "畲族"), 
	GaoShan(23, "高山族"), 
	LaHu(24, "拉祜族"),
	Shui(25, "水族"), 
	DongXiang(26, "东乡族"), 
	NaXi(27, "纳西族"), 
	JingPo(28, "景颇族"), 
	KeErKeZi(29, "柯尔克孜族"), 
	Tu(30, "土族"), 
	DaWoEr(31, "达斡尔族"),
	MuLao(32, "仫佬族"), 
	Qiang(33, "羌族"), 
	BuLang(34, "布朗族"), 
	SaLa(35, "撒拉族"), 
	MaoNan(36, "毛南族"), 
	YiLao(37, "仡佬族"), 
	XiBo(38, "锡伯族"), 
	AChang(39, "阿昌族"),
	PuMi(40, "普米族"), 
	TaJiKe(41, "塔吉克族"), 
	Nu(42, "怒族"), 
	WuZiBieKe(43, "乌孜别克族"), 
	ELuoSi(44, "俄罗斯族"), 
	EWenKe(45, "鄂温克族"),
	DeAng(46, "德昂族"),
	BoAn(47, "保安族"), 
	YuGu(48, "裕固族"),
	Jing(49, "京族"),
	TaTaEr(50, "塔塔尔族"),
	DuLong(51, "独龙族"),
	ELunChun(52, "鄂伦春族"),
	HaoZhe(53, "赫哲族"),
	MenBa(54, "门巴族"),
	LoBa(55, "珞巴族"),
	JiNuo(56, "基诺族"),
	Other(57, "其他");
	
	private int mark;
	private String chineseName;

    private Nation(int mark, String chineseName) {
    	this.mark = mark;
        this.chineseName = chineseName;
    }

    public String getChineseName() {
        return this.chineseName;
    }
	
    public int getMark() {
    	return this.mark;
    }
    
    private static final String DATA_REG = "^[0-9]*$";
    public static Nation getNationByMarch(String val) {
    	boolean isInt = Pattern.matches(DATA_REG, val);
    	Nation result = null;
    	if (isInt) {
    		int valInt = Integer.parseInt(val);
    		for (Nation s : Nation.values()) {
    			if (s.getMark() == valInt) {
    				result = s;
    				break;
    			}
    		}
    	} else {
    		for (Nation s : Nation.values()) {
    			if (s.getChineseName().contains(val)) {
    				result = s;
    				break;
    			}
    		}
    	}
        return result;
    }
}
